<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:c="http://java.sun.com/jsp/jstl/core"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:p="http://primefaces.prime.com.tr/ui">


    <body>

        <ui:composition template="./templates/masterLayout.xhtml">
            <ui:define name="content">
                <div class="body">

                    <h:form prependId="false">

                        <p:dataGrid var="item" value="#{productManagedBean.listPro}" columns="3"
                                    rows="9" paginator="true" effect="true" 
                                    paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
                                    rowsPerPageTemplate="9,12,15">
                            <p:column>
                                <div class="port" style="background-color: rgb(249, 249, 249);">
                                    <h2>
                                        <h:outputText value="#{item.productName}"/>
                                    </h2>

                                    <p:graphicImage  width="150" height="150" alt="port" value="#{item.image}"/>
                                    <div class="clr"></div>
                                    <p align="right"><b>Price</b>
                                        <h:outputText value=" #{item.unitPrice} USD"/>
                                    </p>
                                    <div class="clr"></div>
                                    <p>
                                        <h:outputText value="#{item.descriptionBrief}"/>
                                    </p>
                                    <p:commandLink  update="carDetail" action="/ProductDetail"  title="View Detail" ajax="false">
                                        <p:graphicImage value="resources/images/Buttonviewdetail.png" />
                                    </p:commandLink>

                                    <p:commandLink action="/Shoppingcart" title="Buy" ajax="false" actionListener="#{shoppingCartManagedBean.add2cart}">
                                        <p:graphicImage value="resources/images/add-to-cart.png"  styleClass="morenews"/>
                                        <f:param value="#{item.productID}"  name="proID"/>
                                        <f:param value="#{item.productName}"  name="proName"/>
                                        <f:param value="#{item.image}"  name="image"/>
                                        <f:param value="#{item.unitPrice}"  name="price"/>
                                    </p:commandLink>
                                </div>
                            </p:column>
                        </p:dataGrid>
                    </h:form>
                    <div class="clr"></div>
                </div>
            </ui:define>

        </ui:composition>

    </body>
</html>
